package cn.tedu.xctf.boot2.controller;

import cn.tedu.xctf.boot2.entity.Product;
import cn.tedu.xctf.boot2.mapper.ProductMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
//@RestController 相当于controller注解的细化,在每个方法上都加了@ResponseBody注解
@RestController
public class ProductController {

    @Autowired//自动装配注解
    ProductMapper mapper;

    @RequestMapping("/insert")
    public String insert(Product product){
        System.out.println("product="+product);
        mapper.insert(product);
        return "添加成功";
    }
}
